package com.java.day03;

import toolClass.tool;

public class printStart {
    public static void main(String[] args) {
        //行数
        int line=5;
        //空格数
        int space;
        //打印倒三角
        printStartDown(line);
        //打印反三角
        printStartReturn(line);

        //调用方法
        tool.printStart(5);
    }


    private static void printStartDown(int line) {
        for (int i = line; i >= 1; i--) {
            for (int j = 1; j<= i; j++) {
                System.out.print("*");
            }
            System.out.println();
        }
    }

    private static void printStartReturn(int line) {
        int space;
        for (int i = 1; i <= line; i++) {
            //空格数=总行数-当前行数
            space = line -i;
            //打印空格
            for (int j=space;j>=1;j--){
                System.out.print(" ");
            }
            //打印星号
            for (int j = 1; j <=i; j++) {
                System.out.print("*");
            }
            System.out.println();
        }
    }

}
